home *** CD-ROM | disk | FTP | other *** search
/ Hacker CD 2 / HACKER_CD.iso / Hacker_CD / somm.dxr / 00004_recadrage image.ls < prev    next >
Encoding:
Text File  |  2003-04-09  |  2.0 KB  |  41 lines

  1. on resize NumDuSprite, NumDuMember, X, Y
  2.   global DoitReadapterTailleImage, tailleorigin, comptetour, choix, theme, types, listefichier, images, jpg
  3.   taille_origine(X, Y, NumDuMember)
  4.   if (DoitReadapterTailleImage = 1) and ((getAt(tailleorigin, 1) > X) or (getAt(tailleorigin, 2) > Y)) then
  5.     compteclic = 0
  6.     set the floatPrecision to 2
  7.     if (float(X) / float(getAt(tailleorigin, 1))) < (float(Y) / float(getAt(tailleorigin, 2))) then
  8.       prctplusreduit = float(X) / float(getAt(tailleorigin, 1)) * 100
  9.       set the height of sprite NumDuSprite to float(getAt(tailleorigin, 2)) * float(prctplusreduit) / 100
  10.       set the width of sprite NumDuSprite to float(getAt(tailleorigin, 1)) * float(prctplusreduit) / 100
  11.     else
  12.       prctplusreduit = float(Y) / float(getAt(tailleorigin, 2)) * 100
  13.       set the width of sprite NumDuSprite to float(getAt(tailleorigin, 1)) * float(prctplusreduit) / 100
  14.       set the height of sprite NumDuSprite to float(getAt(tailleorigin, 2)) * float(prctplusreduit) / 100
  15.     end if
  16.   else
  17.     if (DoitReadapterTailleImage = 1) and ((the width of sprite NumDuSprite > X) or (the height of sprite NumDuSprite > Y)) then
  18.       compteclic = 0
  19.       set the width of sprite NumDuSprite to getAt(tailleorigin, 1)
  20.       set the height of sprite NumDuSprite to getAt(tailleorigin, 2)
  21.     else
  22.       if (X - getAt(tailleorigin, 1)) < (Y - getAt(tailleorigin, 2)) then
  23.         PrctPlusGrand = 100 - (getAt(tailleorigin, 1) * 100 / X)
  24.         put "PrctPlusGrand X : " & PrctPlusGrand
  25.       else
  26.         PrctPlusGrand = 100 - (getAt(tailleorigin, 2) * 100 / Y)
  27.         put "PrctPlusGrand y : " & PrctPlusGrand
  28.       end if
  29.       set the width of sprite NumDuSprite to getAt(tailleorigin, 1) + (X * PrctPlusGrand / 100)
  30.       set the height of sprite NumDuSprite to getAt(tailleorigin, 2) + (Y * PrctPlusGrand / 100)
  31.     end if
  32.   end if
  33.   updateStage()
  34. end
  35.  
  36. on taille_origine X, Y, NumDuMember
  37.   global tailleorigin, DoitReadapterTailleImage
  38.   tailleorigin = list(member(NumDuMember).width, member(NumDuMember).height)
  39.   DoitReadapterTailleImage = 1
  40. end
  41.